﻿<UserControl x:Class="BattleforgeAssault.GameView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:l="clr-namespace:BattleforgeAssault"             
             mc:Ignorable="d"
             d:DesignHeight="800" d:DesignWidth="1280"
             Loaded="OnLoaded"
             SizeChanged="OnScreenSizeChanged"
             >
    <Grid x:Name="LayoutRoot" Background="DimGray">
        <Grid x:Name="LocationLayer">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <l:LocationView Grid.Row="0" Grid.Column="0" DataContext="{Binding Players[1].Kingdom}" />
            <l:LocationView Grid.Row="0" Grid.Column="1" DataContext="{Binding Players[1].Battlefield}" />
            <l:LocationView Grid.Row="0" Grid.Column="2" DataContext="{Binding Players[1].Quest}" />

            <Grid Grid.Row="1" Grid.Column="0" x:Name="statusArea">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" >
                    <StackPanel.Resources>
                        <Style TargetType="TextBlock">
                            <Setter Property="VerticalAlignment" Value="Center" />
                            <Setter Property="FontSize" Value="14" />
                        </Style>
                    </StackPanel.Resources>
                    <TextBlock Text="{Binding State}" Foreground="Silver" />
                    <TextBlock Text="{Binding ActivePlayer, StringFormat=\ &lt;\{0\}&gt;}" />
                    <TextBlock Text="{Binding StatusMessage, StringFormat=\ \{0\}}" />
                </StackPanel>

                <ListBox Grid.Row="1" x:Name="messageList" Background="Silver" Foreground="DimGray" />

                <StackPanel Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
                    <TextBlock Text="{Binding ActivePlayer.Name, StringFormat=\{0\}\'s}" Margin="0 0 4 0" />
                    <TextBlock Text="{Binding ActivePlayer.Resources, StringFormat=Resources: \{0\}}" />
                </StackPanel>
            </Grid>

            <l:LocationView Grid.Row="1" Grid.Column="1" DataContext="{Binding Table}" />

            <Grid Grid.Row="1" Grid.Column="2" VerticalAlignment="Bottom">
                <Border x:Name="targetsArea" Visibility="Collapsed" Background="#EEE" CornerRadius="4" BorderBrush="DimGray" BorderThickness="2" Padding="2">
                    <StackPanel Background="#EEE">
                        <TextBlock x:Name="targetsDescription" />
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Button x:Name="targetDoneButton" Grid.Column="2" Content="Done" Click="OnTargetsSelected" Padding="20 4" />
                        </Grid>
                    </StackPanel>
                </Border>

                <Border x:Name="queryArea" Visibility="Collapsed" Background="#EEE" CornerRadius="4" BorderBrush="DimGray" BorderThickness="2" Padding="2">
                    <StackPanel Background="#EEE">
                        <TextBlock Text="{Binding Question}" />
                        <ListBox x:Name="queryAnswerList" ItemsSource="{Binding Answers}" Background="#BBB" />
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <Button x:Name="queryDoneButton" Grid.Column="2" Content="OK" Click="OnQueryAnswered" Padding="20 4" />
                        </Grid>
                    </StackPanel>
                </Border>
            </Grid>

            <l:LocationView Grid.Row="2" Grid.Column="0" DataContext="{Binding Players[0].Kingdom}" />
            <l:LocationView Grid.Row="2" Grid.Column="1" DataContext="{Binding Players[0].Battlefield}" />
            <l:LocationView Grid.Row="2" Grid.Column="2" DataContext="{Binding Players[0].Quest}" />

            <l:LocationView Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" DataContext="{Binding Players[0].Hand}" />
        </Grid>
        <Canvas x:Name="CardLayer"/>
    </Grid>
</UserControl>
